﻿using LeRenard.ScriptWars.Model.Scripting.Definitions;
namespace LeRenard.ScriptWars.Model.Scripting
{
    /// <summary>
    /// Implementation of a concrete operation parameter.
    /// </summary>
    public sealed class OperationParameter : IOperationParameter
    {
        #region Properties
        /// <summary>
        /// Gets the associated definition of the parameter.
        /// </summary>
        public IOperationParameterDefinition Definition { get { return _definition; } }
        private readonly IOperationParameterDefinition _definition;

        /// <summary>
        /// Gets the value of the parameter.
        /// </summary>
        public string Value { get { return _value; } }
        private readonly string _value;
        #endregion

        #region Construction
        /// <summary>
        /// Creates a new <see cref="OperationParameter"/> object.
        /// </summary>
        /// <param name="value">The value of the parameter.</param>
        /// <param name="definition">The definition of the parameter.</param>
        public OperationParameter(string value, IOperationParameterDefinition definition)
        {
            ThrowIf.NullOrEmpty(() => value);
            ThrowIf.Null(() => definition);

            _value = value;
            _definition = definition;
        }
        #endregion
    }
}
